# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-pytest-postgresql
_pkgname=pytest-postgresql
pkgver=6.1.1
pkgrel=0
pkgdesc="Postgresql fixtures and fixture factories for Pytest."
url="https://pypi.org/project/pytest-postgresql/"
# riscv64: test unit failure due to database system is still starting up
arch="noarch !riscv64"
license="Apache-2.0"
depends="py3-pytest py3-port-for py3-psycopg py3-mirakuru postgresql16"
makedepends="py3-setuptools py3-wheel py3-gpep517"
checkdepends="py3-pytest-cov py3-pytest-xdist"
subpackages="$pkgname-pyc"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/ClearcodeHQ/pytest-postgresql/archive/refs/tags/v$pkgver.tar.gz
	parser_set-pgctl-location-to-bin.patch
	test_do-not-reimport-plugin.patch
	"
builddir="$srcdir"/$_pkgname-$pkgver

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	# tests/docker: requires a working docker daemon
	.testenv/bin/python3 -m pytest -v --ignore tests/docker
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl
}

sha512sums="
544eabbf666490e753e06df41596a452229fe3432680af985ebc5aa461b4ae7bd238924dd2652e254afd829a6658d3cddf97c873b967ed43ec34f9c158063733  py3-pytest-postgresql-6.1.1.tar.gz
d789615c9b4fce2890873815450fb6d98e6dc9e37a0ddc6cd75d2d03dadc60d062ffea966e9ca0376655d7785e309ba4d3a73f01276fc7c4f8c58f145eb45ea8  parser_set-pgctl-location-to-bin.patch
553ba894d2828ab9f48e81cb4717c8ceda83409b7d397551192068e5f4261ec15fa3bacc25a319c41a2ee8a8baebd35f55b3d8e9ae1556cd073cee3e7a536e8b  test_do-not-reimport-plugin.patch
"
